import api from './api'
import movieApi from './movie'
export const searchMovie = searchValue => {
	return api.post('/index/search', { searchValue }).then(res => {
		// 只有返回值里面有电影的数据才会进行修改
		if (res.data.searchData && res.data.searchData.movie) {
			res.data.searchData.movie.data.forEach(x => {
				return (x = movieApi.change(x))
			})
		}
		return res.data
	})
}
const indexApi = {
	showRank: () => {
		return api.get('/index/showRank').then(res => {
			return res.data.data
		})
	}
}
export default indexApi
